package co.edu.poligran.cluseva.distancias;

import weka.core.Instance;

public class DistanciaEuclidiana extends Distancia {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Override
	public double calcular(Instance instanceX, Instance instanceY) {
		Double suma = 0.0;
		for (int i = 0; i < instanceX.numAttributes() ; i++) {
			Double sumaAux = Math.pow(instanceY.value(i) - instanceX.value(i), 2);
			//System.out.println("X> " + instanceX.value(i) + " Y> " + instanceY.value(i));
			//System.out.println("sumaAux> " + sumaAux);
			suma += sumaAux;
		}
		//System.out.println("suma> " + suma);
		return Math.sqrt(suma);
	}

	@Override
	public double calcular(Instance instanceX, Instance instanceY, int etiqueta) {
		Double suma = 0.0;
		for (int i = 0; i < instanceX.numAttributes() - etiqueta; i++) {
			Double sumaAux = Math.pow(instanceY.value(i) - instanceX.value(i), 2);
			suma += sumaAux;
		}
		System.out.println( "Euclidiana> " + Math.sqrt(suma) );
		return Math.sqrt(suma);
	}

	//3 Metodos que se deben llamar de la NormalizaDistance
	
	@Override
	public String globalInfo() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	protected double updateDistance(double arg0, double arg1) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public String getRevision() {
		// TODO Auto-generated method stub
		return null;
	}
}
